//出院模板
<template>
  <div class="medical-record">
    <!-- 文档容器 -->
    <div class="document-container">
      <!-- 文档标题 -->
      <div class="document-title">
        <h2 class="main-title">{{ initialData.mainTitle }}</h2>
        <p class="sub-title">{{ initialData.subTitle }}</p>
      </div>

      <!-- 基本信息表格 -->
      <div class="info-table-section">
        <table class="info-table">
          <tr>
            <td class="label">姓名</td>
            <td class="value">{{ initialData.name }}</td>
            <td class="label">性别</td>
            <td class="value">{{ initialData.gender }}</td>
            <td class="label">年龄</td>
            <td class="value">{{ initialData.age }}</td>
          </tr>
          <tr>
            <td class="label">科室</td>
            <td class="value">{{ initialData.department }}</td>
            <td class="label">床号</td>
            <td class="value">{{ initialData.bedNumber }}</td>
            <td class="label">病案号</td>
            <td class="value">{{ initialData.caseNumber }}</td>
          </tr>
          <tr>
            <td class="label">入院日期</td>
            <td class="value">{{ initialData.admissionDate }}</td>
            <td class="label">出院日期</td>
            <td class="value">{{ initialData.dischargeDate }}</td>
            <td class="label">住院天数</td>
            <td class="value">{{ initialData.hospitalDays }}天</td>
          </tr>
        </table>
      </div>

      <!-- 文档内容区域 -->
      <div class="document-content">
        <!-- 入院情况 -->
        <div class="content-section">
          <div class="section-title">入院情况</div>
          <div class="section-content">{{ initialData.admissionStatus }}</div>
        </div>

        <!-- 诊疗经过 -->
        <div class="content-section">
          <div class="section-title">诊疗经过</div>
          <div class="section-content">{{ initialData.treatmentProcess }}</div>
        </div>

        <!-- 出院情况 -->
        <div class="content-section">
          <div class="section-title">出院情况</div>
          <div class="section-content">{{ initialData.dischargeStatus }}</div>
        </div>

        <!-- 出院诊断 -->
        <div class="content-section">
          <div class="section-title">出院诊断</div>
          <div class="section-content">{{ initialData.dischargeDiagnosis }}</div>
        </div>

        <!-- 出院医嘱 -->
        <div class="content-section">
          <div class="section-title">出院医嘱</div>
          <div class="section-content">{{ initialData.dischargeOrders }}</div>
        </div>
      </div>

      <!-- 签名区域 -->
      <div class="signature-section">
        <div class="date-section">
          签署日期：{{ initialData.dischargeDate }}
        </div>
        <div class="doctor-signature">
          <span class="label">医师签名：</span>
          <span class="value">{{ initialData.doctorSignature }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  initialData: {
    type: Object,
    default: () => ({}),
  },
});
</script>

<style scoped>
.medical-record {
  background-color: #fff;
  min-height: 100vh;
  padding: 20px;
}

.document-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.document-title {
  text-align: center;
  margin-bottom: 30px;
}

.main-title {
  font-size: 20px;
  font-weight: bold;
  margin: 0 0 8px 0;
  color: #000;
}

.sub-title {
  font-size: 16px;
  color: #333;
  margin: 0;
}

.info-table-section {
  margin-bottom: 20px;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.info-table td {
  padding: 8px 12px;
  border: 1px solid #ddd;
}

.info-table .label {
  background-color: #f8f8f8;
  font-weight: 500;
  width: 80px;
  color: #333;
}

.info-table .value {
  width: 120px;
}

.document-content {
  line-height: 1.8;
}

.content-section {
  margin-bottom: 30px;
}

.section-title {
  font-size: 16px;
  font-weight: bold;
  color: #000;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #eee;
}

.section-content {
  color: #333;
  font-size: 14px;
  line-height: 1.8;
  text-align: justify;
  padding: 0 8px;
}

.signature-section {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

.date-section {
  color: #666;
  font-size: 14px;
}

.doctor-signature {
  text-align: right;
}

.doctor-signature .label {
  color: #333;
  font-weight: normal;
  margin-right: 10px;
}

.doctor-signature .value {
  color: #333;
  font-weight: normal;
  border-bottom: 1px solid #333;
  padding: 0 20px 2px;
  display: inline-block;
}

@media print {
  .medical-record {
    padding: 0;
  }

  .document-container {
    box-shadow: none;
    padding: 20px;
  }

  .info-table td {
    border-color: #000;
  }

  .section-title {
    border-bottom-color: #000;
  }
}

@media (max-width: 768px) {
  .medical-record {
    padding: 10px;
  }

  .document-container {
    padding: 20px;
  }

  .info-table td {
    padding: 6px 8px;
    font-size: 14px;
  }

  .info-table .label {
    width: 60px;
  }

  .info-table .value {
    width: auto;
  }
}
</style>
